/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package sistemareserva;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 *
 * @author 19028027-6
 */
public class Conectar {

   static String bd = "Reservahotel"; 
   static String login = "pruebadia5"; 
   static String password = "proyecto123"; 
   static String url = "jdbc:derby://localhost:1527/"+bd; 
 
   Connection conn = null; 
    
   public Conectar() { 
      try{          
         Class.forName("org.apache.derby.jdbc.ClientDriver");          
         conn = DriverManager.getConnection(url,login,password); 
         if (conn!=null){ 
            System.out.println("Conección a base de datos "+bd+". listo"); 
         } 
      }catch(SQLException e){ 
         System.out.println(e); 
      }catch(ClassNotFoundException e){ 
         System.out.println(e); 
      } 
   }
   
   
      public Connection getConnection(){ 
      return conn; 
   } 
 
   public void desconectar(){ 
      conn = null; 
   } 
   

    
}
